import { createRouter, createWebHistory } from 'vue-router'
import LoginView from '../views/LoginView.vue'

const routes = [
  {
    path: '/',
    name: 'login',
    component: LoginView
  },
  {
    path: '/dashboard',
    name: 'dashboard',
    component: () => import('@/layouts/DashboardLayout.vue'),
    meta: { title: "系统管理" },
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/HomeView.vue'),
        meta: { title: "首页" }
      },
      {
        path: 'users',
        name: 'users',
        component: () => import('@/views/UsersView.vue'),
        meta: { title: "用户管理" }
      },
      {
        path: 'SqlStore',
        name: 'SqlStore',
        component: () => import('@/views/SqlSoreView.vue'),
        meta: { title: "慢查询分析" }
      },
      {
        path: 'UIautomation',
        name: 'UIautomation',
        component: () => import('@/views/UIautomationView.vue'),
        meta: { title: "UI自动化" }
      },
      {
        path: 'ReportView',
        name: 'ReportView',
        component: () => import('@/views/ReportView.vue'),
        meta: { title: "测试报告" }
      },
      {
        path: 'ApiView',
        name: 'ApiView',
        component: () => import('@/views/ApiView.vue'),
        meta: { title: "测试用例" }
      },
      {
        path: 'AiCaseView',
        name: 'AiCaseView',
        component: () => import('@/views/AiCaseView.vue'),
        meta: { title: "AI用例" }
      },
      {
        path: 'ApiReportView',
        name: 'ApiReportView',
        component: () => import('@/views/ApiReportView.vue'),
        meta: { title: "API测试结果" }
      },
      {
        path: 'SecretView',
        name: 'SecretView',
        component: () => import('@/views/SecretView.vue'),
        meta: { title: "密钥管理" }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
